package com.wqz.dac;

public class Hannotower {
    public static void main(String[] args) {
        hannoiTower(4,'a','b','c');
    }

    public static void hannoiTower(int num, char a, char b, char c) {
        if (num == 1) {
            System.out.println("第1个盘从" + a + "->" + c);
        } else {
            hannoiTower(num - 1, a, c, b);
            System.out.println("第" + num + "个盘从" + a + "->" + c);
            hannoiTower(num -1, b, a, c);
        }

    }
}
